<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <#assign base=request.contextPath  />
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title></title>
    <link rel="stylesheet" href="../frame/layui/css/layui.css">
    <link rel="stylesheet" href="../frame/static/css/style.css">
    <link rel="icon" href="../frame/static/image/code.png">
    <script type="text/javascript" src="../frame/layui/layui.all.js"></script>
    <script type="text/javascript" src="${base}/js/zhang.js"></script>
<script type="text/javascript" src="../frame/layui/layui.all.js"></script>
    <script src="${base}/js/jquery-1.8.3.min.js"></script>

</head>

<body class="body">
<div class="ziyemianbiju">
            <table class="layui-hide" id="test" lay-filter="test"></table>
            <script type="text/html" id="barDemo">
                <button  class="layui-btn layui-btn-normal layui-btn-xs "  lay-event="edit"  >通过</button>
            </script>
    <script type="text/javascript">
        layui.use(['layer','form','table'], function(){
            var form = layui.form;
            var table = layui.table;
            var layer = layui.layer;
            var $ = layui.jquery;
            table.render({
                even: true,//开启隔行背景
                size: 'sm',//小尺寸的表格
                elem: '#test',
                toolbar: '#toolbarDemo',
                url: '${base}/Tuizu/select',
                title: '用户数据表',
                cols: [[
                    {type: 'checkbox',width:40}
                    ,{field:'ptName', title: '所属公司',align:'center'}
                    ,{field:'carNumber', title: '车牌号',align:'center'}
                    ,{field:'carType', title: '车型号 ',align: 'center'}
                    ,{field:'carBrand', title: '车品牌 ',align: 'center'}
                    ,{field:'carName', title: '车名',align: 'center'}
                    ,{field:'createTime', title: ' 创建时间 ',align: 'center'}
                    ,{field:'callName', title: ' 联系人名称 ',align: 'center'}
                    ,{field:'callPhone', title: '联系人手机号',align:'center'}
                    ,{field:'examine', title: '是否通过',align:'center',
                        templet:function(val){
                            var flag=val.examine;
                            if(flag==2){
                                return "不通过"
                            }else{
                                return"通过"
                            }
                        }}
                    ,{field:'eczxxxxema', title: '审核', align:'center', toolbar: '#barDemo'}
                ]]
                ,id: 'testReload'
                ,height:480
                ,page: {
                    layout: ['limit', 'count', 'prev', 'page', 'next', 'skip']
                    ,theme: '#9AC747'
                    ,limit: 10
                }
            });





            //页面传参
     table.on('tool(test)', function(obj){
                var layEvent = obj.event;
                if(layEvent=="edit"){
                        var data = obj.data;
                  /*  var table = layui.table;
                    //表刷新方法
                    table.reload('testReload', {
                        url: '${base}/Tuizu/select',
                        where: {} //设定异步数据接口的额外参数
                    });*/
                    $.ajax({
                        type:"POST",
                        data:{id:data.id,carId:data.carId,userId:data.userId},
                        url:"${base}/Tuizu/check",
                        success : function(data){
                        if(data==true){
                             var table = layui.table;
                            table.reload('testReload', {
                                url: '${base}/Tuizu/select',
                        where: {} //设定异步数据接口的额外参数
                    });
                        }else {
                            alert("该企业已退租")
                        }
                        }
                    });

           } ;
        });
        });










    </script>
</body>

</html>